export const downloadIcon = { pdf: 'icon-PDF', exe: 'icon-EXE', txt: 'icon-TXT' } as any;

// // 按钮节流
export const debounce = (func: { apply: (arg0: any, arg1: any[]) => void; }, time: number | undefined, ctx?: any, immediate?: any) => {
  // eslint-disable-next-line no-undef
  let timer: any
  const rtn = (...params: any[]) => {
    clearTimeout(timer)
    if (immediate) {
      const callNow = !timer
      timer = setTimeout(() => {
        timer = null
      }, time)
      if (callNow) func.apply(ctx, params)
    } else {
      timer = setTimeout(() => {
        func.apply(ctx, params)
      }, time)
    }
  }
  return rtn
}